package com.example.leetcode.top100;

class Top7 {
    public int reverse(int x) {
        int rev = 0;
        while (x != 0) {
            if (rev < Integer.MIN_VALUE / 10 || rev > Integer.MAX_VALUE / 10) {
                return 0;
            }
            int diget = x % 10;
            x = x / 10;
            rev = rev * 10 + diget;

        }
        return rev;
    }

    public static void main(String[] args) {

    }
}